import Vue from 'vue'
import VueRouter from 'vue-router'
import Main from "@/views/Main/Main";
import store from '../store/index'
import resiger from "@/views/resiger/resiger";
Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login/login'),
  }, {
    path: '/fogetPassword',
    name: 'fogetPassword',
    component: () => import('@/views/login/fogetPassword'),
  },
  {
    path: '/resiger',
    name: 'resiger',
    component:resiger,
  },
  {
    path: '/newsSingle',
    name: 'newsSingle',
    component: () => import('@/views/newsCenter/newsDetail/newsDetail'),
  },
  {
    path: '/',
    name: 'Main',
    component: Main,
    children: [
      {
        path: '/Home',
        name: 'home',
        component: () => import('@/views/Home/Home'),
      },{
        path: '/customsDeclaration',
        name: 'customsDeclaration',
        component: () => import('@/views/customsDeclaration/customsDeclaration'),
      },{
        path: '/apiNoOpen',
        name: 'apiNoOpen',
        component: () => import('@/views/apiServe/apiNoOpen'),
      },
      {
        path: '/searchHome',
        name: 'searchHome',
        component: () => import('@/views/searchPage/searchPage'),
      },
      {
        path: '/bigPage4',
        name: 'bigPage4',
        component: () => import('@/views/Main/bigPage4'),
        children: [
          {
            path: '/shippingManifest',
            name: 'shippingManifest',
            meta: {
              title: '装载舱单'
            },
            component: () => import('@/views/shippingManifest/index')
          },
          {
            path: '/originalManifest',
            name: 'originalManifest',
            meta: {
              title: '原始舱单'
            },
            component: () => import('@/views/originalManifest/index')
          },
          {
            path: '/preFurnishedManifest',
            name: 'preFurnishedManifest',
            meta: {
              title: '预配舱单'
            },
            component: () => import('@/views/preFurnishedManifest/index')
          },
          {
            path: '/logisticsLink',
            name: 'logisticsLink',
            meta: {
              title: '物流环节'
            },
            component: () => import('@/views/logisticsLink/index')
          }
        ]
      },
      {
        path: '/bigPage2',
        name: 'bigPage2',
        component: () => import('@/views/Main/bigPage2'),
        children: [
          {
            path: '/noPermission2',
            name: 'noPermission2',
            component: () => import('@/views/Main/noPermission')
          },
          {
            path: '/empty2',
            name: 'empty2',
            component: () => import('@/views/empty/empty')
          },
          {
            path: '/success',
            name: 'success',
            meta: {
              title: '成功'
            },
            component: () => import('@/components/success.vue'),
          },
          {
            path: '/shipPlan/addContainer',
            name: 'addContainer',
            meta: {
              title: '集装箱船期'
            },
            component: () => import('@/views/shipPlan/components/addPlan.vue')
          },
          {
            path: '/shipPlan/addBulk',
            name: 'addBulk',
            meta: {
              title: '件散货船期'
            },
            component: () => import('@/views/shipPlan/components/addPlan.vue')
          },
          {
            path: '/goodContent/unloadLift',
            name: 'jUnloadLift',
            meta: {
              title: '卸船直提'
            },
            component: () => import('@/views/businessProcessing/goodContent/goodsPlan'),
          },

          // {
          //   path: '/goodContent/goodsPlan',
          //   name: 'goodsPlan',
          //   meta: {
          //     title:'企业信息'
          //   },
          //   component: () => import('@/views/businessProcessing/goodContent/goodsPlan'),
          // },
          {
            path: '/goodContent/unloadIn',
            name: 'jUnloadIn',
            meta: {
              title: '卸船入库'
            },
            component: () => import('@/views/businessProcessing/goodContent/goodsPlan'),
          },
          {
            path: '/goodContent/loadLift',
            name: 'jLoadLift',
            meta: {
              title: '装船直装'
            },
            component: () => import('@/views/businessProcessing/goodContent/goodsPlan'),
          },
          {
            path: '/goodContent/loadIn',
            name: 'jLoadIn',
            meta: {
              title: '装船出库'
            },
            component: () => import('@/views/businessProcessing/goodContent/goodsPlan1'),
          },
          {
            path: '/goodContent/import',
            name: 'jImport',
            meta: {
              title: '进货'
            },
            component: () => import('@/views/businessProcessing/goodContent/goodsPlan'),
          },
          {
            path: '/goodContent/output',
            name: 'jOutput',
            meta: {
              title: '提货'
            },
            component: () => import('@/views/businessProcessing/goodContent/goodsPlan1'),
          },
          {
            path: '/emptyBox/emptyBox',
            name: 'emptyBox',
            meta: {
              title: '进空箱'
            },
            component: () => import('@/views/businessProcessing/emptyBox/emptyBox'),
          },
          {
            path: '/emptyBox/emptyBoxNum',
            name: 'emptyBoxNum',
            meta: {
              title: '提空箱（指定箱号）'
            },
            component: () => import('@/views/businessProcessing/emptyBox/emptyBoxNum'),
          },
          {
            path: '/emptyBox/emptyBoxNoNum',
            name: 'emptyBoxNoNum',
            meta: {
              title: '提空箱（不指定箱号）'
            },
            component: () => import('@/views/businessProcessing/emptyBox/emptyBoxNoNum'),
          },
          {
            path: '/heavyBox/heavyBox',
            name: 'heavyBox',
            meta: {
              title: '进重箱'
            },
            component: () => import('@/views/businessProcessing/heavyBox/heavyBox'),
          },
          {
            path: '/heavyBox/heayBoxNum',
            name: 'heayBoxNum',
            meta: {
              title: '提重箱'
            },
            component: () => import('@/views/businessProcessing/heavyBox/heayBoxNum'),
          },
          {
            path: '/heavyEmpty/heavyEmpty',
            name: 'heavyEmpty',
            meta: {
              title: '提重返空'
            },
            component: () => import('@/views/businessProcessing/emptyHeavy/heavyEmpty'),
          },
          {
            path: '/heavyEmpty/emptyHeavyNum',
            name: 'emptyHeavyNum',
            meta: {
              title: '提空返重（指定箱号）'
            },
            component: () => import('@/views/businessProcessing/emptyHeavy/emptyHeavyNum'),
          },
          {
            path: '/heavyEmpty/emptyHeavyNoNum',
            name: 'emptyHeavyNoNum',
            meta: {
              title: '提空返重（不指定箱号）'
            },
            component: () => import('@/views/businessProcessing/emptyHeavy/emptyHeavyNoNum'),
          },
          {
            path: '/unpacking/unpacking',
            name: 'unpacking',
            meta: {
              title: '拆箱'
            },
            component: () => import('@/views/businessProcessing/unpacking/unpacking'),
          },
          {
            path: '/unpacking/packingNum',
            name: 'packingNum',
            meta: {
              title: '装箱（指定箱号）'
            },
            component: () => import('@/views/businessProcessing/unpacking/packingNum'),
          },
          {
            path: '/unpacking/packingNoNum',
            name: 'packingNoNum',
            meta: {
              title: '装箱（不指定箱号）'
            },
            component: () => import('@/views/businessProcessing/unpacking/packingNoNum'),
          },

          {
            path: '/whiteCard/whiteCard',
            name: 'whiteCard',
            meta: {
              title: '白卡办理'
            },
            component: () => import('@/views/businessProcessing/whiteCard/whiteCard'),
          },

          {
            path: '/shipPlan/loadList',
            name: 'loadList',
            meta: {
              title: '装船清单'
            },
            component: () => import('@/views/shipPlan/module/loadList'),
          },
          {
            path: '/shipPlan/unloadList',
            name: 'unloadList',
            meta: {
              title: '卸船清单'
            },
            component: () => import('@/views/shipPlan/module/unloadList'),
          },
        ]
      },
      {
        path: '/bigPage1',
        name: 'bigPage1',
        component: () => import('@/views/Main/bigPage1'),
        children: [
          {
            path: '/noPermission1',
            name: 'noPermission1',
            component: () => import('@/views/Main/noPermission')
          },
          {
            path: '/api',
            name: 'api',
            meta: {
              title: 'API服务'
            },
            component: () => import('@/views/apiServe/api/api')
          }, 
          {
            path: '/manifestInformation',
            name: 'manifestInformation',
            meta: {
              title: '舱单信息'
            },
            component: () => import('@/views/manifestInformation/index')
          },
          {
            path: '/vehicleOperation',
            name: 'vehicleOperation',
            meta: {
              title: '客户进出明细'
            },
            component: () => import('@/views/queryStatistics/vehicleOperation')
          }, 

          {
            path: '/containerVehicleDetails',
            name: 'containerVehicleDetails',
            meta: {
              title: '集装箱运输明细'
            },
            component: () => import('@/views/queryStatistics/containerVehicleDetails')
          }, 

          {
            path: '/goodsDetails',
            name: 'goodsDetails',
            meta: {
              title: '场存动态'
            },
            component: () => import('@/views/queryStatistics/goodsDetails')
          }, 
          {
            path: '/empty1',
            name: 'empty1',
            component: () => import('@/views/empty/empty')
          },{
            path: '/myMessage',
            name: 'myMessage',
            component: () => import('@/views/messagePage/myMessage')
          },
          {
            path: '/safetyGuard',
            name: 'safetyGuard',
            component: () => import('@/views/messagePage/safetyGuard')
          },
          {
            path: '/shipPlan/shipPlanList',
            name: 'shipPlanList',
            meta: {
              title: '船期计划'
            },
            component: () => import('@/views/shipPlan/module/shipPlanList.vue'),
          },
          {
            path: '/goodContent/goods',
            name: 'jGoods',
            meta: {
              title: '件散货业务'
            },
            component: () => import('@/views/businessProcessing/goodContent/goods'),
          },
          {
            path: '/goodContent/boxGoods',
            name: 'boxGoods',
            meta: {
              title: '集装箱业务'
            },
            component: () => import('@/views/businessProcessing/goodContent/boxGoods'),
          },
          {

            path: '/userCenter/userInfo',
            meta: {
              title: '企业信息'
            },
            name: 'userInfo',
            component: () => import('@/views/userCenter/userInfo/userInfo'),
          },
		  {

            path: '/fleetInformation/fleetList',
            meta: {
              title: '车队信息'
            },
            name: 'userInfo',
            component: () => import('@/views/fleetInformation/module/fleetInformation'),
          },
		      {

            path: '/userInformation',
            meta: {
              title: '用户信息'
            },
            name: 'userInformation',
            component: () => import('@/views/userCenter/userInformation/userInformation'),
          },
          // {
          //
          //   path: '/userCenter/myOrder',
          //   meta: {
          //     title:'我的订单'
          //   },
          //   name: 'myOrder',
          //   component: () => import('@/views/userCenter/myOrder/myOrder'),
          // }
        ]
      },
      {
        path: '/bigPage3',
        name:'bigPage3',
        component: () => import('@/views/Main/bigPage3'),
        children:[
          // apiNoOpen
          {
            path: '/apiNoOpen',
            name: 'apiNoOpen',
            component: () => import('@/views/apiServe/apiNoOpen'),
          },
          {
            // apiDetial
            path: '/apiDetial',
            name: 'apiDetial',
            meta: {
              title: '数据服务'
            },
            component: () => import('@/views/apiServe/apiDetial/apiDetial'),
          }
        ]
      },

      {
        path: '/successPage',
        name: 'successPage',
        component: () => import('@/components/successPage.vue'),
      },
      {
        path: '/personalAdvice',
        name: 'personalAdvice',
        component: () => import('@/views/personalAdvice/advice'),
      },
      {
        path: '/adviceDetail',
        name: 'adviceDetail',
        component: () => import('@/views/personalAdvice/adviceDetail'),
      },
      {
        path: '/newsCenter',
        name: 'newsCenter',
        component: () => import('@/views/newsCenter/newsCenter'),
        children: [
          {
            path: '/newsCenter/newsList',
            name: 'newsList',
            component: () => import('@/views/newsCenter/newsList/newsList'),
          },
          {
            path: '/newsCenter/newsDetail',
            name: 'newsDetail',
            component: () => import('@/views/newsCenter/newsDetail/newsDetail'),
          }
        ]
      }, {
        path: '/businessProcessing',
        name: 'businessProcessing',
        component: () => import('@/views/businessProcessing/businessProcessingCenter'),
        children: [
          {
            path: '/businessProcessing/bulkCargo',
            name: 'bulkCargo',
            component: () => import('@/views/businessProcessing/bulkCargo/bulkCargo'),
          },
          {
            path: '/businessProcessing/bulkCargoL',
            name: 'bulkCargoL',
            component: () => import('@/views/businessProcessing/bulkCargo/bulkCargo'),
          },
          {
            path: '/businessProcessing/bulkCargoLB',
            name: 'bulkCargoLB',
            component: () => import('@/views/businessProcessing/bulkCargo/bulkCargo'),
          },
          {
            path: '/businessProcessing/bulkCargoH',
            name: 'bulkCargoH',
            component: () => import('@/views/businessProcessing/bulkCargo/bulkCargo'),
          },

          {
            path: '/businessProcessing/bulkCargoJk',
            name: 'bulkCargoJk',
            component: () => import('@/views/businessProcessing/bulkCargo/bulkCargo'),
          },
          {
            path: '/businessProcessing/bulkCargoJz',
            name: 'bulkCargoJz',
            component: () => import('@/views/businessProcessing/bulkCargo/bulkCargo'),
          },
          {
            path: '/businessProcessing/bulkCargoTz',
            name: 'bulkCargoTz',
            component: () => import('@/views/businessProcessing/bulkCargo/bulkCargo'),
          },
          {
            path: '/businessProcessing/bulkCargoTkp',
            name: 'bulkCargoTkp',
            component: () => import('@/views/businessProcessing/bulkCargo/bulkCargo'),
          },
          {
            path: '/businessProcessing/bulkCargoTkn',
            name: 'bulkCargoLB',
            component: () => import('@/views/businessProcessing/bulkCargo/bulkCargo'),
          },
          {
            path: '/businessProcessing/bulkCargoCar',
            name: 'bulkCargoCar',
            component: () => import('@/views/businessProcessing/bulkCargo/bulkCargo'),
          },
          {
            path: '/businessProcessing/bulkCargoZz',
            name: 'bulkCargoZz',
            component: () => import('@/views/businessProcessing/bulkCargo/bulkCargo'),
          },
          {
            path: '/businessProcessing/bulkCargoZxp',
            name: 'bulkCargoZxp',
            component: () => import('@/views/businessProcessing/bulkCargo/bulkCargo'),
          },
          {
            path: '/businessProcessing/bulkCargoZxn',
            name: 'bulkCargoZxn',
            component: () => import('@/views/businessProcessing/bulkCargo/bulkCargo'),
          },

          {
            path: '/businessProcessing/bulkCargoList',
            name: 'bulkCargoList',
            component: () => import('@/views/businessProcessing/bulkCargo/bulkCargoList'),
          },
          {
            path: '/businessProcessing/unloadLift',
            name: 'unloadLift',
            component: () => import('@/views/businessProcessing/unloadLift/unloadLift'),
          },
          {
            path: '/businessProcessing/unloadLiftPlan',
            name: 'unloadLiftPlan',
            component: () => import('@/views/businessProcessing/unloadLift/unloadLiftPlan'),
          },
          {
            path: '/businessProcessing/unloadIn',
            name: 'unloadIn',
            component: () => import('@/views/businessProcessing/unloadLift/unloadLift'),
          },
          {
            path: '/businessProcessing/loadLift',
            name: 'loadLift',
            component: () => import('@/views/businessProcessing/unloadLift/unloadLift'),
          },
          {
            path: '/businessProcessing/loadIn',
            name: 'loadIn',
            component: () => import('@/views/businessProcessing/unloadLift/unloadLift'),
          },
          {
            path: '/businessProcessing/import',
            name: 'import',
            component: () => import('@/views/businessProcessing/unloadLift/unloadLift'),
          },
          {
            path: '/businessProcessing/output',
            name: 'output',
            component: () => import('@/views/businessProcessing/unloadLift/unloadLift'),
          },
          {
            path: '/message',
            name: 'message',
            component: () => import('@/views/myMessage/message')
          },


        ]
      },

    ]
  },
]

const router = new VueRouter({
  routes
})
router.beforeEach((to, from, next) => {
  if (to.path == '/') {
    next({ name: 'home' })
  } else {
    next()
  }

})
router.afterEach(()=>{
  window.scrollTo(0,0)
})
export default router
